<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusPersonnelFileTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_personnel_file', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('type')->nullable()->comment('类型');
            $table->string('file_name')->nullable()->comment('文件名称');
            $table->string('file_path')->nullable()->comment('文件路径');
            $table->string('file_type')->nullable()->comment('文件类型');
            $table->integer('file_size')->nullable()->comment('文件大小');
            $table->unsignedInteger('user_id')->nullable()->comment('用户id');
            $table->unsignedBigInteger('personnel_id')->comment('人员ID');
            $table->foreign('personnel_id')->references('id')->on('akbus_personnel')->onDelete('cascade');
            $table->string('note')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_personnel_file');
    }
}
